/*
 * ProcessForm.java
 *
 * Created on 12 de junio de 2008, 11:15 PM
 */
package social.p2p.ui;

import javax.swing.JDialog;
import javax.swing.JLabel;

/**
 *
 * @author  camilo
 */
public class ProcessForm extends JDialog {

    private final static ProcessForm instance = new ProcessForm();

    public static void setText(String msg) {
         instance.getLblMensaje().setText("<html>Por favor espere estamos <p>procesando su información<p><p><b>"+msg+"</b>");
    }

    /** Creates new form ProcessForm */
    private ProcessForm() {
        initComponents();
        setLocationRelativeTo(null);
    }

    public static void show(String msg) {
        instance.setModal(true);
        instance.getLblMensaje().setText("<html>Por favor espere estamos <p>procesando su información<p><p><b>"+msg+"</b>");
        instance.setVisible(true);
    }

    public static void hideIt() {
        instance.setVisible(false);
    }

    public JLabel getLblMensaje() {
        return lblMensaje;
    }

    public void setLblMensaje(JLabel lblMensaje) {
        this.lblMensaje = lblMensaje;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jProgressBar1 = new javax.swing.JProgressBar();
        lblMensaje = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Procesando ...");
        setUndecorated(true);

        jProgressBar1.setIndeterminate(true);

        lblMensaje.setIcon(new javax.swing.ImageIcon(getClass().getResource("/social/p2p/ui/img/procesar_128.png"))); // NOI18N
        lblMensaje.setText("<html>Por favor espere estamos <p>procesando su información");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblMensaje)
                    .addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 325, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(lblMensaje, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new ProcessForm().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JProgressBar jProgressBar1;
    private javax.swing.JLabel lblMensaje;
    // End of variables declaration//GEN-END:variables
}
